import wepy from 'wepy'

export const getCourses = () => wepy.request('/course')

export const getCourse = id => wepy.request(`/course/${id}`)

export const getCourseComments = (id, page = 1, size = 10, judgeType) => wepy.request(`/course/comment/${id}?page=${page}&size=${size}&order=${judgeType}`)

export const getNewCourseList = () => wepy.request('/desk/getList')

export const getOneDetail = id => wepy.request(`/course/getLesson/${id}`)

export const getLessMoment = (id, page = 1) => wepy.request(`/course/lesson/${id}?page=${page}`)

export const couseDetail = id => wepy.request(`/course/${id}`)

export const getDayCourse = () => wepy.request('/course/getHome')

export const getCommentsAll = id => wepy.request(`/discuss/getDetailComment/${id}`)

export const getCourseList = id => wepy.request(`/course/getLessonList/${id}`)

export const getShareUnder = () => wepy.request('/course/product')

export const getDeskContent = (day) => wepy.request(`/desk/getClickList?page=${day}&size=8`)

export const getJons = data => wepy.request({
  url: '/course/permission',
  method: 'POST',
  data
})

export const sendTalk = data => wepy.request({
  url: '/discuss/comment',
  method: 'POST',
  data
})

export const getMyCourses = () => wepy.request('/desk', {
  method: 'POST'
})

export const getCourseUnit = id => wepy.request(`/course/unit/${id}`)

export const pay = data => wepy.request({
  url: '/pay/unifiedorder',
  method: 'POST',
  data
})
